import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { cameraPatrolTaskVO, cameraPatrolTaskForm, cameraPatrolTaskQuery } from '@/api/camera/camera-patrol-task/types';

/**
 * 查询巡视任务列表
 * @param query
 * @returns {*}
 */

export const listcameraPatrolTask = (query?: cameraPatrolTaskQuery): AxiosPromise<cameraPatrolTaskVO[]> => {
  return request({
    url: '/camera/camera-patrol-task/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡视任务详细
 * @param cameraPatrolTaskId
 */
export const getcameraPatrolTask = (cameraPatrolTaskId: string | number): AxiosPromise<cameraPatrolTaskVO> => {
  return request({
    url: '/camera/camera-patrol-task/' + cameraPatrolTaskId,
    method: 'get'
  });
};

/**
 * 新增巡视任务
 * @param data
 */
export const addcameraPatrolTask = (data: cameraPatrolTaskForm) => {
  return request({
    url: '/camera/camera-patrol-task',
    method: 'post',
    data: data
  });
};

/**
 * 停用启用
 * @param data
 */
export const updatecameraPatrolTaskeditStatus = (data: cameraPatrolTaskForm) => {
  return request({
    url: '/camera/camera-patrol-task/editStatus',
    method: 'post',
    data: data
  });
};
export const updatecameraPatrolTask = (data: cameraPatrolTaskForm) => {
  return request({
    url: '/camera/camera-patrol-task',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡视任务
 * @param cameraPatrolTaskId
 */
export const delcameraPatrolTask = (cameraPatrolTaskId: string | number | Array<string | number>) => {
  return request({
    url: '/camera/camera-patrol-task/' + cameraPatrolTaskId,
    method: 'delete'
  });
};
